<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/tips.js"></script>
<script src="${staticServer}/js/web/consultant_client_tracking_list.js"></script>
<script src="${staticServer}/js/web/system_reserve_list.js?1.2"></script>
<script>
var contextPath='${contextPath}';

var selectMsg = function(){
	var sdate = $("#start_date").val();
	var edate = $("#end_date").val();
	if(sdate>edate){
			alert("选择日期出错。请重新选择！");
			$("#start_date").val(" ");
			$("#end_date").val(" ");
			return;
		}
	window.location.href=encodeURI("${contextPath}/index/system_keyword_stat.htm?startTime="+startTime+"&endTime="+endTime);
}

function starquery(type)
{
	var url = "";
	
	if(type==0)
	{
		var client = $("#client").val();
		var user = $("#user").val();
		var address = $("#address").val();
		var phone = $("#phone").val();
		var email = $("#email").val();
		var start_date = $("#start_date").val();
		var end_date = $("#end_date").val();
		
		var qq = $("#qq").val();
		var source = $("#sources").val();
		var param_str = "";

		if(!empty(client)) param_str += "&knickname=" + client;
		if(!empty(user)) param_str += "&snickname=" + user;
		if(!empty(address)) param_str += "&province=" + address;
		if(!empty(phone)) param_str += "&phone=" + phone;
		if(!empty(email)) param_str += "&email=" + email;
		if(!empty(start_date)) param_str += "&start_date=" + start_date;
		if(!empty(end_date)) param_str += "&end_date=" + end_date;
		if(!empty(qq)) param_str += "&qq=" + qq;
		if(!empty(source)) param_str += "&source=" + source;
		url = "?" + param_str;
	}
	else
	{
		url = "";
	}
	
	location.href = "${contextPath}/index/system_reserve_list.htm"+url;
}
$(function(){
	
	$("#sources").val("${source}");
})
var getFollow = function(keyname,id){
	$("#traId").val(id);
	$.post("${contextPath}/index/get_client_follow.json", {
		"keyname":keyname
	}, function(ms) {
		var list = ms.list;
		var objHtml = "";
		$("#trackList"+id).val("");
		if(list!=null){
			var j=list.length+1;
			for(var i=0;i<list.length;i++){
				var state = "";
				if(list[i].state=="" || list[i].state==null){
					state = '<a class="stateitem caption">无变化</a>';
				}else{
					state = '<a class="stateitem">'+list[i].state+'</a>';
				}
				if(list[i].state2=="" || list[i].state2==null){
					state2 = '';
				}else{
					state2 = '<a class="stateitem">'+list[i].state2+'</a>';
				}
				if(list[i].state3=="" || list[i].state3==null){
					state3 = '';
				}else{
					state3 = '<a class="stateitem">'+list[i].state3+'</a>';
				}
				objHtml += '<ul>'+
	            			'<li>'+
	            				'<p class="trackingtitle" style="display: block;">第 '+(--j)+' 次跟踪记录<em class="caption">（负责人：'+list[i].nickname+'　日期：'+list[i].createTime+'）</em><a class="btnHidden"></a></p>'+
	            				'<p class="trackingstate" style="display: block;"><b>客户状态</b><span>'+state+state2+state3+'</span></p>'+
	            				'<p style="display: block;"><b>备注情况</b></p>'+
	            				'<div class="content" style="display: block;">'+list[i].remark+'</div>'+
	            			'</li>'+
	            		'</ul>'
			}
			$("#trackList"+id).html('<a class="stress unit" onclick="remove_tracking()"> 点击隐藏跟踪记录 </a>'+objHtml);
			$("#__TRACKING_LIST"+id).show();
		}
		
	});
}

var remove_tracking = function(){
	var id = $("#traId").val();
	$("#__TRACKING_LIST"+id).hide();
}
</script>
</head>

<body>
<input type="hidden" id="traId" value="">
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>帐号管理</li>
			<li>&gt;</li>
			<li class="current">客户预约数据管理</li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table class="simple_table" rel="nohover" style="min-width: 750px;">
			<tr>
				<td><label for="client">客户名字：</label> 
					<input type="text" id="client" size="15" placeholder="客户名字" value="" /> 
				<label for="user">接待老师：</label> 
					<input type="text" id="user" size="15" value="" placeholder="接待老师名字" /> 
				<label for="address">地区：</label> 
					<input type="text" id="address" size="28" placeholder="省、市、地址" value="" /></td>
				<td rowspan="2">
					<input type="button" value=" 查 询 " onclick="starquery(0)" /> 
					<input type="button" value=" 重 置 " onclick="starquery(1)" />
				</td>
			</tr>
			<tr>
				<td width="670"><label for="phone">联系电话：</label> <input type="text" id="phone" size="15" placeholder="客户联系电话"
					value="" /> <label for="qq">ＱＱ号码：</label> <input type="text" id="qq" size="15"
					placeholder="QQ号码" value="" /> <label for="email">邮箱：</label> <input type="text" id="email"
					size="28" placeholder="Email地址" value="" /></td>
			</tr>
			<tr>
				<td>
				<label for="start_date">起始日期：</label>
				<input type="text" name="start_date" id="start_date" size="15"value="${sdate}" rel="DATE::Y-m-d" /> 
				<label for="end_date">终止日期：</label>
				<input type="text" name="end_date" id="end_date" size="15"value="${edate}" rel="DATE::Y-m-d" />
				
					<label for="phone">来源渠道：</label> <select id="sources"><option value="">-- 请选择 --</option><option value='cru0943rdrf2' title='用于标记无效资源'>未知</option><option value='nupd5182xxsl' title=''>网站问卷</option><option value='l6xdybjjrcjc' title=''>手机问卷</option><option value='czhi7pjiadhu' title=''>19楼问卷</option><option value='l6e69n6t0xdf' title=''>微博问卷</option><option value='osjrem0am5af' title=''>微博粉丝通问卷</option><option value='eyxl17rri7xu' title=''>搜狗搜索</option><option value='jd2q59wq41ed' title='来源于百度搜索的竞价收费资源'>百度搜索</option><option value='251mokab1mtn' title=''>百度网盟</option><option value='l0j9fitg3t94' title='来源于百度搜索的免费资源'>百度自然搜索</option><option value='cwo3dhreyo3g' title=''>百度知道</option><option value='hcat5zqt7jta' title=''>百度教育</option><option value='zgviq7wj9j0p' title=''>360搜索</option><option value='pmvk5vdc6ity' title='请填写具体网址'>商桥其它</option><option value='3p5idbdw49di' title=''>公益讲座</option><option value='nmeq3ambzitw' title=''>培训通</option><option value='k4jmt5lbp8ne' title=''>400电话</option><option value='09ceooqhs782' title=''>广告推广</option><option value='dz6favkfbcpb' title='直接或间接因素上门咨询'>上门咨询</option><option value='ka3e06t6qqni' title=''>本地电话</option><option value='wxc7hq1lln1y' title=''>家长转介绍</option><option value='iwpby6xld7x1' title=''>淘宝旺旺</option><option value='txrf7rjlaq0n' title=''>返学费网</option><option value='3uz0gyx626dp' title=''>搜学校网</option><option value='0n2njx5zmzvo' title=''>网站留言</option><option value='ct5yq4jhc6c7' title=''>市场部推广</option><option value='oaw3mfz6l521' title=''>哈哈儿童网</option><option value='oymhrrozjjqq' title=''>直接访问</option><option value='lyx063wpay9l' title=''>百度推广</option><option value='ro9iszkillrp' title=''>微信问卷</option><option value='c0lnj8or2mrr' title=''>报纸广告</option><option value='5a2l1xsq7dcp' title=''>已测试</option><option value='pcalex0wpcy3' title=''>网站手机抓取</option><option value='k3i6bvxdlm2d' title=''>QQ老资料</option><option value='895q48oh4jpp' title=''>百度贴吧</option><option value='gx50j0s9hrr1' title=''>传单派发</option><option value='edhhjon7t6za' title=''>商桥留言</option><option value='13b6lzltt0xk' title=''>网站报名</option><option value='v04u5uv2490h' title=''>新浪扶翼</option><option value='8yjy5cw5w5x0' title=''>网络部推广</option><option value='fu9d8zgsndne' title=''>内部推荐</option><option value='3qttf7j4ydu3' title=''>东书房合作</option><option value='ewk5wys8ylqa' title=''>电销部门</option><option value='cwfxxia9nn3l' title=''>上海外呼诺访</option><option value='96tcllg3xk21' title=''>58同城</option><option value='cxn6ozuszles' title=''>赶集网</option><option value='wtukdq8gp65h' title=''>市场部问卷</option><option value='frvmppoifgmb' title=''>今日头条广告</option><option value='kip4mcx4i9bf' title=''>远播网</option><option value='udfjjispr43w' title=''>淘宝咨询</option><option value='kzpctoxsbclx' title=''>百度推课</option><option value='dbmtj1jhld70' title=''>淘宝推广</option><option value='kk51qfgzk1rq' title=''>教育联展网</option><option value='8vhblyaircwt' title=''>教育宝</option></select> 
				</td>
			</tr>
		</table>
		<table>
			<tr class="fields">
				<th>预约日期</th>
				<th>客户姓名</th>
				<th>预约中心</th>
				<th>所在地</th>
				<th>接待人</th>
				<th>类型</th>
				<th>联系方式</th>
				<th>操作</th>
			</tr>
			
			<#if list??>
				<#list list as list>
					<tr class="even_row">
						<td align="center"><span class="quote">${list.date?date}</span><br>${list.time}</td>
						<td align="center" class="stress">${list.nickname}<em class="valid"><#if list.invalid=="0">（有效）<#else>（无效）</#if></em></td>
						<td align="center">${list.regionns}</td>
						<td align="center">${list.province} - ${list.city}</td>
						<td align="center">${list.receptioner}</td>
						<td align="center"><#if list.non=="0">测评<#else>非测评</#if></td>
						<td align="center" name="${list.phone}">
						<#if list.phlist??>
							<a title="<#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
							<#list list.phlist as phlist>
							<#assign phone = "${phlist.phone}">
							<#if phlist.name=="爸爸" || phlist.name=="妈妈">
								<em class="caption">电话：</em>${phlist.phone}<br/>
								<em class="caption">关系：</em>${phlist.name}<br/>
							<#elseif phlist.guanxi!="">
								<em class="caption">电话：</em>${phlist.phone}<br/>
								<em class="caption">关系：</em>${phlist.guanxi}<br/>
							<#else>
								<em class="caption">电话：</em>${phlist.phone}<br/>
								<em class="caption">关系：</em>${phlist.name}<br/>
							</#if>
     						</#list>
     						</a>
     						<#else>
						<a title="<#if list.phone!="" && list.phone?contains('[]')==false>电话：${list.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
     						<#if list.phone!="" && list.phone?contains('[]')==false>
     						<em class="caption">电话：</em>${list.phone}
     						<#elseif list.qq!="">
     						<em class="caption">QQ:</em>${list.qq}
     						<#elseif list.weixin!="">
     						<em class="caption">微信:</em>${list.weixin}
     						<#elseif list.email!="">
     						<em class="caption">email:</em>${list.email}
     						</#if>
     						</a>
     					  </#if>
						
						</td>
						<td align="center">
					<#if webutil.getCookieUser().usergroup=="8">
						<a rel="DEL::${list.keyname}">删除</a> - 
					</#if>
						<a class="btnSearchTracking" onclick="getFollow('${list.client}','${list.id}')">历史跟踪(${list.tracksize})</a> - 
						<a href="${contextPath}/index/system_reserve_view.htm?keyname=${list.keyname}">详细信息</a></td>
					</tr>
					<tr id="__TRACKING_LIST${list.id}" style="display:none">
	            		<td colspan="10" class="trackinglst" id="trackList${list.id}">
	            		</td>
	            	</tr>
				</#list>
			</#if>
		</table>
	</div>
	
	<div id="pager" style="width: 849px;">
	<ul id="pagination">
		<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
	<#if currpage==1 >
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/index/system_reserve_list.htm?currPage=${currpage-1}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">上一页</a></li>
					</#if>
					
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/system_reserve_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reserve_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/system_reserve_list.htm?currPage=${pagetotal}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/system_reserve_list.htm?currPage=1&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reserve_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/system_reserve_list.htm?currPage=${pagetotal}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/index/system_reserve_list.htm?currPage=1&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reserve_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/system_reserve_list.htm?currPage=${currpage+1}&knickname=${knickname}&snickname=${snickname}&province=${province}&phone=${phone1}&email=${email}&qq=${qq}&start_date=${sdate}&end_date=${edate}&source=${source}">下一页</a></li>
		</#if>
		<li class="pageinfo">共${page.total}条记录</li>
	</#if>
	</ul>
	</div>
	<div class="emptyline"></div>
</body>
</html>